<template>
	<view class="courseCourse">
		<view class="BGIMG" :style="{'background-image':`url(${URL}${objectData.Cover})`}">

		</view>
		<view class="content">
			<view class="Title">
				{{objectData.Title}}
			</view>
			<view class="AcclaimRate" v-if="objectData.AcclaimRate>=0">
				<span >{{objectData.AcclaimRate}}%好评</span>
			</view>
			<view class="bottomBox">
				<view class="Price">
					<span class="fuhao">￥</span>
					<span class="zhengshu">{{Price(objectData.Price)}}</span>
					<span class="dian">.</span>
					<span class="xiaoshu">{{Price1(objectData.Price)}}</span>
				</view>
				<view class="PayCount">
					{{objectData.PayCount}}人{{QuantityName}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			objectData: {
				type: Object,
				default: {}
			},
			QuantityName:{
				type:String,
				default:'已购买'
			}
		},
		data() {
			return {
				URL: this.$config.domain.staticUrl,
			}
		},
		methods: {
			// 价格格式调整
			Price(e) {
				let num = Math.floor(e)
				if (num >= 0) {
					return num
				} else {
					return e
				}
			},
			Price1(e) {
				let afterNum = (e % 1).toFixed(2).substring(2)
				if (afterNum >= 0) {
					return afterNum
				}
			},
		},
		created() {
		}
	}
</script>

<style lang="scss" scoped>
	.courseCourse {
		display: flex;
		flex-direction: column;
		border-bottom-left-radius: 8rpx;
		border-bottom-right-radius: 8rpx;

		.BGIMG {
			border-top-left-radius: 12rpx;
			border-top-right-radius: 12rpx;
			// background-position: center;
			background-repeat: no-repeat;
			background-size: 100%;
			width: 100%;
			height: 190rpx;
			overflow: hidden;
		}

		.content {
			box-sizing: border-box;
			padding: 20rpx;
			background-color: #fff;
			border-radius: 10rpx 10rpx 10rpx 10rpx;

			.Title {
				font-size: 26rpx;
				font-family: PingFang SC-Bold;
				color: #000000;
				white-space: normal;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				min-height: 70rpx;
			}

			.AcclaimRate {
				margin: 20rpx 0rpx;

				span {
					font-size: 26rpx;
					font-family: PingFang SC-Bold;
					color: #E0AF3C;
					border-radius: 12rpx;
					box-sizing: border-box;
					border: 2rpx solid #E0AF3C;
					padding: 6rpx 16rpx;
				}
			}

			.bottomBox {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: flex-end;

				.Price {
					font-family: PingFang SC-Bold;
					color: #F35370;

					.fuhao {
						font-size: 26rpx;
						font-weight: bold;
					}

					.zhengshu {
						font-size: 38rpx;
						font-weight: bold;
					}

					.dian {
						font-size: 42rpx;
					}

					.xiaoshu {
						font-size: 26rpx;
					}
				}

				.PayCount {
					font-size: 24rpx;
					font-family: PingFang SC-Bold;
					color: #999999;
				}
			}

		}
	}
</style>